;-----------------------------------------------------------------;
;Begin Buffer_Init routine
;	Sets up the FIFO buffer
;	Prerequisites: 	None
;	Input:			None
;	Output:			None
;	Cycles:			329
;	Bank change:	No
	extern Buffer_Init

;-----------------------------------------------------------------;
;Begin Buffer_Pop routine
;	Gets and removes the next element out of the FIFO buffer
;	Prerequisites: 	None
;	Input:			None
;	Output:			Action 	-> BUFFER_POP_ACTION
;					Data	-> BUFFER_POP_DATA
;	Cycles:			7 - 10(RARE)
;	Bank change:	No
;	extern Buffer_Pop
	
;-----------------------------------------------------------------;
;Begin Buffer_Drop routine
;	Removes the next element from the FIFO buffer
;	Prerequisites: 	None
;	Input:			None
;	Output:			None
;	Cycles:			3-6(RARE)
;	Bank change:	No
	extern Buffer_Drop
	
;-----------------------------------------------------------------;
;Begin Buffer_Peek_Action routine
;	Gets the next element in the FIFO buffer
;	Prerequisites: 	None
;	Input:			None
;	Output:			Action 	-> W
;					0x00 	-> W If no data
;	Cycles:			7
;	Bank change:	No
	extern Buffer_Peek_Action
	
;-----------------------------------------------------------------;
;Begin Buffer_Peek_Data routine
;	Gets the next element's Data in the FIFO buffer
;	Prerequisites: 	None
;	Input:			None
;	Output:			Data 	-> W
;	Cycles:			4
;	Bank change:	No
	extern Buffer_Peek_Data
	
;-----------------------------------------------------------------;
;Begin Buffer_Push routine
;	Adds an element to the FIFO buffer
;	Prerequisites: 	None
;	Input:			Action 	<- BUFFER_PUSH_ACTION
;					Data	<- BUFFER_PUSH_DATA
;	Output:			None
;	Cycles:			8-11(RARE)
;	Bank change:	No
	extern Buffer_Push
	
;-----------------------------------------------------------------;
;Begin Buffer_Push_Action routine
;	Adds an element with no data to the FIFO buffer
;	Prerequisites: 	None
;	Input:			Action 	<- BUFFER_PUSH_ACTION
;	Output:			None
;	Cycles:			6-9(RARE)
;	Bank change:	No
	extern Buffer_Push_Action
	
;-----------------------------------------------------------------;
;Begin Buffer_Push_Action_Fast macro
;	Adds an element with no data to the FIFO buffer (doesnt check for overrunes)
;	Prerequisites: 	None
;	Input:			Action 	<- BUFFER_PUSH_ACTION
;	Output:			None
;	Cycles:			6-7(RARE)
;	Bank change:	No
Buffer_Push_Action_Fast macro
	LOCAL	END_OF_PUSH_ACTION_MACRO
	MOVF	BUFFER_LAST,W,A
	MOVFF	BUFFER_PUSH_ACTION,ACTION_BUFFER_W
	;NOP
	
	;INCREMENT THE COUNTER
	DECFSZ	BUFFER_LAST,F,A
	BRA		END_OF_PUSH_ACTION_MACRO

	MOVLW	BUFFER_LENGTH
	MOVWF	BUFFER_LAST,A
	
;	;IF WE HAVE REACHED THE END, WRAP AROUND
;	MOVF	BUFFER_LAST,W,A
;	SUBLW	BUFFER_LENGTH
;	BTFSC	STATUS,Z,A		
;	CLRF	BUFFER_LAST,A
END_OF_PUSH_ACTION_MACRO
	endm
;-----------------------------------------------------------------;
;Begin Buffer_Has_Data routine
;	Check the status of the FIFO buffer
;	Prerequisites: 	None
;	Input:			None
;	Output:			W	(0x00 if no data)
;	Cycles:			4
;	Bank change:	No
	;extern Buffer_Has_Data
	
;-----------------------------------------------------------------;
;Begin Buffer_ReAssign_Next routine
;	Change the action of the next element in the FIFO buffer
;	Prerequisites: 	None
;	Input:			Action 	<- BUFFER_PUSH_ACTION
;	Output:			None
;	Cycles:			4
;	Bank change:	No
	extern Buffer_ReAssign_Next
